//
//  ISSafetyAlarmMamanger.h
//  iPhoneSafety
//
//  Created by dl on 2019/1/3.
//  Copyright © 2019 com.li.ding. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, ISSafetyAlarmStrategy){
    ISSafetyAlarmStrategyNone            = 0,
    ISSafetyAlarmStrategyPocket          = 1 <<  0,
    ISSafetyAlarmStrategyDesk            = 1 <<  1,
    ISSafetyAlarmStrategyCharging        = 1 <<  2,
    ISSafetyAlarmStrategyAirplan         = 1 <<  3,
    ISSafetyAlarmStrategyHeadset         = 1 <<  4,
    ISSafetyAlarmStrategyAll             = ~0UL
};

typedef NS_ENUM(NSUInteger, ISSafetyAlarmPocketState) {
    ISSafetyAlarmPocketStateClosed,
    ISSafetyAlarmPocketStatePrepare,
    ISSafetyAlarmPocketStateReady,
    ISSafetyAlarmPocketStateAlarming
};

typedef NS_ENUM(NSUInteger, ISSafetyAlarmDeskState) {
    ISSafetyAlarmDeskStateClosed,
    ISSafetyAlarmDeskStatePrepare,
    ISSafetyAlarmDeskStateReady,
    ISSafetyAlarmDeskStateAlarming
};

typedef NS_ENUM(NSUInteger, ISSafetyAlarmChargingState) {
    ISSafetyAlarmChargingStateClosed,
    ISSafetyAlarmChargingStatePrepare,
    ISSafetyAlarmChargingStateReady,
    ISSafetyAlarmChargingStateAlarming
};

typedef NS_ENUM(NSUInteger, ISSafetyAlarmAirplanState) {
    ISSafetyAlarmAirplanStateClosed,     // 未开启监听
    ISSafetyAlarmAirplanStateReady,      // 已经开启, 等待打开飞行模式
    ISSafetyAlarmAirplanStateAlarming   // 正在警报
};

typedef NS_ENUM(NSUInteger, ISSafetyAlarmHeadsetState) {
    ISSafetyAlarmHeadsetStateClosed,
    ISSafetyAlarmHeadsetStatePrepare,
    ISSafetyAlarmHeadsetStateReady,
    ISSafetyAlarmHeadsetStateAlarming
};

FOUNDATION_EXPORT NSString * const kISSafetyAlarmStateDidChangeNotification;
FOUNDATION_EXPORT NSString * const kISSafetyAlarmStateAlarmingNotification;

@interface ISSafetyAlarmMamanger : NSObject

NW_SINGLETON_INSTANCE_METHOD_DECLARATION

@property (nonatomic, assign, readonly) ISSafetyAlarmStrategy strategy;

@property (nonatomic, assign, readonly) ISSafetyAlarmPocketState alarmPocketState;
@property (nonatomic, assign, readonly) ISSafetyAlarmDeskState alarmDeskState;
@property (nonatomic, assign, readonly) ISSafetyAlarmChargingState alarmChargingState;
@property (nonatomic, assign, readonly) ISSafetyAlarmAirplanState alarmAirplanState;
@property (nonatomic, assign, readonly) ISSafetyAlarmHeadsetState alarmHeadsetState;

@property (nonatomic, assign, readonly, getter=isAlarming) BOOL alarming;
@property (nonatomic, assign, readonly, getter=isAllClosed) BOOL allClosed;

- (BOOL) onOrCloseWithStrategy:(ISSafetyAlarmStrategy)strategy;
- (void) onOrCloseStrategy:(ISSafetyAlarmStrategy)strategy on:(BOOL)isOn;
- (void) startMonitoringWithStrategy:(ISSafetyAlarmStrategy)strategy;
- (BOOL) startMonitoringWithStrategyStatus;
- (void) stop;

@end

NS_ASSUME_NONNULL_END
